#!/bin/bash

# ----------------------------------------------------------------------
# Filename:   75672-auditctl-s.sh
# Version:    1.0
# Date:       2013/12/12
# Author:     yuanhui.shi
# Email:      yuanhui.shi@cs2c.com.cn
# Summary:    03系统安全功能-02审计功能-01auditctl-02显示规则状态
# Notes:      auditctl -e -s
# Copyright:  China Standard Software Co., Ltd.
# History：     
#             Version 1.0, 2013/12/12
#             -   The first one
# ----------------------------------------------------------------------

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

source ../../../lib/Echo.sh
source ./lib/cmd.sh
source ../../../lib/XmlParse.sh


function CleanData ()
{
  rm -rf /tmp/tmp1
  rm -rf /tmp/tmp2
  EchoInfo "75672-auditctl-s.sh执行完毕"
}

trap "CleanData" EXIT


auditctl -e 0 >/tmp/tmp1
auditctl -s >/tmp/tmp2

[ "`cat /tmp/tmp1 |cut -d " " -f2`" == "enabled=0" -a "`cat /tmp/tmp2 |cut -d " " -f2`" == "enabled=0" ]
EchoResult "结果正确"

auditctl -e 1 >/tmp/tmp1
auditctl -s >/tmp/tmp2

[ "`cat /tmp/tmp1 |cut -d " " -f2`" == "enabled=1" -a "`cat /tmp/tmp2 |cut -d " " -f2`" == "enabled=1" ]
EchoResult "结果正确"


